package com.mobileares.midp.widgets.client.button;

import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.InlineLabel;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

/**
 * Created by IntelliJ IDEA.
 * User: Tom
 * Date: 2011-3-23
 * Time: 14:34:18
 * To change this template use File | Settings | File Templates.
 */
public class ButtonBar extends Composite {
    private FlowPanel container;
    private List<CButton>  buttons = new ArrayList<CButton>();

    public ButtonBar() {
        container = new FlowPanel();
        initWidget(container);
        setStyleName("button-bar");
    }

    public void addButton(CButton cb) {
        buttons.add(cb);
        container.add(cb);
        container.add(new InlineLabel(" "));
    }

    public void setEnable(boolean flag) {
        for (CButton button:buttons) {
            button.setEnabled(flag);
        }
    }
    public Iterator<CButton> getButtons(){
        return buttons.iterator();
    }

}
